package net.hvacapp.cmvrfforandroid.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import net.hvacapp.cmvrfforandroid.R;

/**
 * TODO: document your custom view class.
 */
public class ProjectActionView extends LinearLayout {
    private TextView mLeftTv;
    private TextView mCenterTv;
    private TextView mRightTv;

    public ProjectActionView(Context context) {
        super(context);
        init(context, 0);
    }

    public ProjectActionView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, 0);
    }

    public ProjectActionView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context, defStyle);
    }

    public void setLeftOnClickListener(OnClickListener onClickListener) {
        mLeftTv.setOnClickListener(onClickListener);
    }

    public void setRightOnClickListener(OnClickListener onClickListener) {
        mRightTv.setOnClickListener(onClickListener);
    }

    public void setActionInfo(int total, int current) {
        if (current == 1) {
            mLeftTv.setText("");
        }
        mCenterTv.setText(current + "/" + total);
    }

    public void setActionBtnString(String left, String right) {
        mLeftTv.setText(left);
        mRightTv.setText(right);
    }


    private void init(Context context, int defStyle) {
        LayoutInflater.from(context).inflate(R.layout.project_action_view, this,
                true);
        mLeftTv = (TextView) findViewById(R.id.tv_left);
        mCenterTv = (TextView) findViewById(R.id.tv_center);
        mRightTv = (TextView) findViewById(R.id.tv_right);
    }
}
